﻿using System;
using System.Collections.Generic;

using DreamCube.Framework.DataAccess.Basic;
using DreamCube.Framework.DataAccess.Sqlserver;

namespace DreamCube.Websites.BLL
{
    /// <summary>
    /// 模块类
    /// </summary>
    public class Module : ModelObject
    {
        #region "字段"

        private Int32 id;
        private Int32 parentID;
        private String title;
        private String clickFunction;
        private Int32 powerCode = -1; //-1是默认值，表示所有人都有权限访问
        private Int32 orderIndex = 0;
        private Int32 status = 0;
        private String iconUrl;
        //子模块
        private List<Module> childModuls = new List<Module>();

        #endregion

        #region "属性"

        /// <summary>
        /// 模块的数据库ID值
        /// </summary>
        public Int32 ID
        {
            get { return this.id; }
            set { this.id = value; }
        }

        /// <summary>
        /// 父类目的ID号
        /// </summary>
        public Int32 ParentID
        {
            get { return this.parentID; }
            set { this.parentID = value; }
        }

        /// <summary>
        /// 模块的标题
        /// </summary>
        public String Title
        {
            get { return this.title; }
            set { this.title = value; }
        }

        /// <summary>
        /// 模块的单击事件
        /// </summary>
        public String ClickFunction
        {
            get { return this.clickFunction; }
            set { this.clickFunction = value; }
        }

        /// <summary>
        /// 对应的权限CODE值
        /// </summary>
        public Int32 PowerCode
        {
            get { return this.powerCode; }
            set { this.powerCode = value; }
        }

        /// <summary>
        /// 排序序号【小（前面）-->大（后面）】
        /// </summary>
        public Int32 OrderIndex
        {
            get { return this.orderIndex; }
            set { this.orderIndex = value; }
        }

        /// <summary>
        /// 状态
        /// </summary>
        public Int32 Status
        {
            get { return this.status; }
            set { this.status = value; }
        }

        /// <summary>
        /// 图标的Url路径
        /// </summary>
        public String IconUrl
        {
            get { return this.iconUrl; }
            set { this.iconUrl = value; }
        }

        /// <summary>
        /// 子模块节点
        /// </summary>
        public List<Module> ChildModules
        {
            get { return this.childModuls; }
        }

        #endregion

        #region "实例方法"

        /// <summary>
        /// 数据库表名
        /// </summary>
        public static String TableName
        {
            get { return "SYS_MODULE"; }
        }

        #endregion
    }
}
